package com.neuedu.demo4;

public class Homework06 {
    public static void main(String[] args) {
        //创建一个数组,随机录入值
        int[]arr={1,5,7,9,0,7,1,9,1,0,9,1,1,6,5,0,0,7,5,0};
        //利用for循环进行遍历
        for (int i = 0; i < arr.length; i++) {
            for (int j = i+1; j < arr.length; j++) {
                //如果在循环过程中发现相同者将这个数该为0
                if (arr[i] == arr[j]&&arr[i]!=0) {
                    arr[j]=0;
                }
            }
        }

        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+" ");
        }
    }
}
